import json
import os
from flask import Blueprint, abort, jsonify, request,send_from_directory, session
from handle.auth import *
from handle.logger import logger
from handle.S2Redis import sync_data_background,render_template,redis_client,socketio
from werkzeug.utils import secure_filename
# 创建一个蓝图对象
user = Blueprint('user', __name__)

@user.route('/<username>', methods=['GET'])
def get_user(username):
    data=get_user_cache(username)
    del data['Password']
    return json.dumps({"status": 200,"message": f"user_data","data": data},sort_keys=False)
    
@user.route('/resetpass/<username>', methods=['PUT'])
def re_pass(username):
    data=request.get_json()
    resetps(username,data['passwd'])
    return json.dumps({"status": 200,"message": f"reset ok"},sort_keys=False)